<template>
  <svg :style="{width:size,height:size}" :class="svgClass" aria-hidden="true">
    <use :xlink:href="iconName" />
  </svg>
</template>

<script>
export default {
  name: 'SvgIcon',
  props: {
    iconClass: {
      type: String,
      required: true
    },
    className: {
      type: String,
      default: ''
    },
    size:{
      type: String,
      default: '18px'
    }
  },
  computed: {
    iconName() {
      return `#icon-${this.iconClass}`
    },
    svgClass() {
      return this.className ? 'svg-icon ' + this.className : 'svg-icon'
    }
  }
}
</script>

<style scoped>
.svg-icon {
  fill: currentColor;
  vertical-align: middle;
}

</style>
